<?
header("Content-Type: application/rss+xml; charset=utf-8");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\r";
?>
<rss version="2.0">
  <?php
  require ("../../config.php");
  require ("../getUserDataFromDB.php");
  ?>
<channel>
<title><?php echo $GLOBALS['setting']['web_title'] ?></title>
<link><?php echo $GLOBALS['url'] ?></link>
<description><?php echo $GLOBALS['setting']['web_subTitle'] ?></description>
<language>cs</language>
<webMaster><?php echo $config['contact']['email'] ?></webMaster>
<?php
require '../seo/seo.php';
$seoParser = new SeoUrl();
$query = $GLOBALS['db']->query("SELECT id, title, pretext, date, author_id FROM " . $GLOBALS['db_prefix'] .
    "articles WHERE published = '1' ORDER BY date DESC");
while ($news = $query->fetch_array()) {
	$author = getUserDataFromDB($news["author_id"]);
    $seoParser->Parse($news["title"]);
    $seo_url = $news["id"] . "-" . $seoParser->result;
    $temp = ($GLOBALS['seo']) ? '' : 'index.php?q=';
    echo "<item>\n";
    echo "<title>" . $news["title"] . "</title>\n";
    echo "<link>" . str_replace("libs/rss/", "", $GLOBALS['url']) . $temp . 'content/single/' . $seo_url .
        "</link>\n";
    echo "<description>" . htmlspecialchars(strip_tags($news["pretext"])) .
        "</description>\n";
        echo "<author>".$author["email"]." (".$author["display_name"].")</author>\n";
        echo "<guid isPermaLink='false'>".$news["id"]."</guid>\n";
    echo "<pubDate>" . date("r",strtotime($news["date"])) . "</pubDate>\n";
    echo "</item>\n";
}

?>
</channel>
</rss>